package com.bjpowernode.ba05;

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

import java.util.Date;

@Aspect
@Component("aspect")
public class MyAspect {
    @Before(value = "execution(* com.bjpowernode.ba05.Target.doMethod(..))")
    public void before(){
        System.out.println("前置通知"+new Date());
    }


    @AfterReturning(value = "execution(* com.bjpowernode.ba05.Target.doMethod(..))"
            ,returning = "res")
    public void afterReturning(Object res){
        System.out.println("后置通知");
    }

}
